using System.Collections.Generic;
using NUnit.Framework;
using wpffc.contracts.domaindata;
using wpffc.flashcardbox.domaindata;

namespace wpffc.flashcardbox.tests.domaindata
{
    [TestFixture]
    public class test_Compartment
    {
        [Test]
        public void Enqueue_card()
        {
            var q = new Queue<Card>();
            var sut = new Compartment(q, 0);
            var c = new Card();

            sut.Enqueue(c);

            Assert.AreEqual(1, q.Count);
            Assert.AreSame(c, q.Dequeue());
        }


        [Test]
        public void Dequeue_card()
        {
            var q = new Queue<Card>();
            var c = new Card();
            q.Enqueue(c);

            var sut = new Compartment(q, 0);

            Assert.AreSame(c, sut.Dequeue());
        }


        [Test]
        public void Status_changes_according_to_filling()
        {
            var sut = new Compartment(2);

            Assert.AreEqual(CompartmentStatus.Empty, sut.Status);

            sut.Enqueue(new Card());
            Assert.AreEqual(CompartmentStatus.Filled, sut.Status);

            sut.Enqueue(new Card());
            Assert.AreEqual(CompartmentStatus.Full, sut.Status);
        }
    }
}